package com.luckberry.murder.mapper;

import com.luckberry.murder.entity.NPC;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NPCMapper {

    @Select("select * from npc")
    List<NPC> getNPCs();

    @Select("select * from npc where nid = #{nid}")
    NPC getNPC(int nid);

    @Select("select * from npc where sid = #{sid}")
    List<NPC> getNPCByScript(int sid);

    @Insert("insert into npc(sid, role, `desc`, face) VALUES (#{sid}, #{role}, #{desc}, #{face})")
    int addNPC(NPC npc);

    @Delete("delete npc from npc where nid = #{nid}")
    int deleteNPC(int nid);

    @Update("update npc set sid = #{sid}, role = #{role}, `desc` = #{desc}, face = #{face} where nid = #{nid}")
    int editNPC(NPC npc);
}
